In a simplest way, we can say that a loss function is a method of evaluating how well your algorithm models your dataset.
In terms of optimization techniques, the function which is used to evaluate a solution is referred to as the objective function.